#ifndef MAINCORE_H
#define MAINCORE_H

#include <QObject>
#include <QMap>
#include "tcp/remoteclient.h"


class NormalScreen;
class ScreenWidget;
class QClipboard;
class QHostAddress;

class MainCore : public QObject
{
    Q_OBJECT
public:
    explicit MainCore(QObject *parent = nullptr);
    virtual ~MainCore();
    bool connectToHost(QHostAddress &address, quint16 port);
signals:

protected slots:
    // 处理host端信号
    void receivedVersion(const QByteArray &version);
    void receivedCreateWindow(int id, int width, int height, int codec);
    void receivedCloseWindow(int id);
//    void receivedResizeWindow(int id, int width, int height, int codec);
    void receivedFramebuffer(int id, const QByteArray &data);
    void receivedCutText(const QString &text);
    void on_disconnected();

    // 处理屏幕信号
    void on_mouseChanged(const Qt::MouseButtons&, bool isPress, const QPoint&);
    void on_keyChanged(int key, bool isPress);
    void on_wheelChanged(int delta);
    void on_min();
    void on_notMin();

    // 处理全局信号
    void on_clipboardChanged();
private:
    RemoteClient *client;
    QMap<int, ScreenWidget*> m_screenDict;
};

#endif // MAINCORE_H
